Open
Conversation
ipArt.h (cmpAddr): Fixed check to avoid OOB when plen == 128 ipArt.c (rtArtDeleteRoute): Subtract nRoutes only when default route is non-null ipArtPathComp.c (rtArtPcDeleteRoute): Subtract nRoutes only when default route is non-null ipArtPathComp.c (rtArtPcDestroy): Avoid freeing pt->pTbl which was not initialised
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dear Yoichi,
Through testing and the use of sanitizers, I believed to have found several bugs that might be worth fixing.
ipArt.h (cmpAddr):
It should be noted that the ( len == plen ) check will never be true since the loop terminating condition is len <= plen.
In addition, with IPV6 and a plen of 128, we will have an OOB read of p1 and p2 when we check remaining bits.
I have changed the check to ( len == plen + 8 ) which correctly handles plen that are a multiple of 8.
ipArt.c (rtArtDeleteRoute): Subtract nRoutes only when default route is non-null
We are subtracting nRoutes even if the route is NULL, which can lead to nRoutes falling below 0.
In rtArtFlushRoutes, we would subsequently calloc(n, sizeof(routeEnt)) where n < 0, leading to an attempt to calloc a large amount of memory.
ipArtPathComp.c (rtArtPcDeleteRoute): Subtract nRoutes only when default route is non-null
Similar to above
ipArtPathComp.c (rtArtPcDestroy): Avoid freeing pt->pTbl which was not initialised
It seems that pt->pTbl was never initialised (unlike ipArt.c) and hence we are freeing a NULL pointer here
Best regards,
Damian